{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.Reliability Fusion Map (RFM)\n",
    "\n",
    "<br>\n",
    "\n",
    "1. `matrix` is global variable from csv file <br>\n",
    "    `f1, f2, f3...` is CNN confidence vector; <br>\n",
    "    `p` = CNN predict label; <br>\n",
    "    `y` = label of patch; <br>\n",
    "    `texture_quality` = patch texture quality factor, see formula(2) in paper\n",
    "    <hr>\n",
    "    \n",
    "2. Fusion step: `filter_texture()`->`fushion_map()`->`fusion_denisty()`; <br>\n",
    "    `filter_texture()`: filter low texture patch predictions of CNN, we set threshold_texture=0;<br>\n",
    "    `fushion_map()`: fusion step1, see formula(3) in paper; <br>\n",
    "    `fusion_denisty()`: fusion step2, see formula(4), (5) in paper; <br>\n",
    "    <hr>\n",
    "\n",
    "3. Output matrix structure is the same as input matrix <br>\n",
    "    <hr>\n",
    "\n",
    "\n",
    "## 2. Step-by-Step Clustering\n",
    "   Clustering step: `k-means` -> `filter_denisty` -> `filter_texture`\n",
    "   <hr>\n",
    "    \n",
    "\n",
    "## 3.About\n",
    "\n",
    "This localization for step by step clustering algorithm proposed in [11] (see experiment 2-2 in paper).\n",
    "\n",
    "<br>\n",
    "\n",
    "\n",
    "## 4.Reference\n",
    "[11] L. Bondi, S. Lameri, D. Gu ̈era, P. Bestagini, E. J. Delp, and S. Tubaro, “Tampering detection and localization through clus- tering of camera-based cnn features,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, 2017, pp. 1855–1864.\n",
    "\n",
    "\n",
    "<br>\n",
    "\n",
    "> $matrix=[f1, f2, f3, f4, f5... p, y, texture_quality]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 349,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os, math, seaborn as sns, numpy as np, pandas as pd, matplotlib.pyplot as plt, matplotlib.image as mpimg\n",
    "from collections import Counter\n",
    "sns.set()\n",
    "\n",
    "# matrix=[f1, f2, f3, f4, f5, p, y, texture_quality]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 325,
   "metadata": {},
   "outputs": [],
   "source": [
    "root_path = \"/data/experiment\"\n",
    "scope_name = \"pre-train_64x64\" # The input csv is 64x64 non-overlap patches\n",
    "\n",
    "csv_root = os.path.join(root_path, scope_name)\n",
    "ground_root = os.path.join(root_path, \"ground\")\n",
    "splice_root = os.path.join(root_path, \"splicing\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 276,
   "metadata": {},
   "outputs": [],
   "source": [
    "def kmeans(matrix, theta, label, w, h):\n",
    "    '''\n",
    "    k-mean clustering (see paper [11], formula (2), (3), (4))\n",
    "    @data=[f1, f2, f3, f4, f5, p, y, quality]\n",
    "    @theta∈[0.0, 1.0]\n",
    "    '''\n",
    "    # calculate index: same=(M=0), diff=(M!=0)\n",
    "    same_index = (matrix[:, 5] == label)\n",
    "    diff_index = (matrix[:, 5] != label)\n",
    "    \n",
    "    # f-mean confidence\n",
    "    f_mean = 1.0 * np.sum(matrix[same_index, 0: 5], axis=0) / np.sum(same_index)\n",
    "    \n",
    "    # d(i, j) see paper [11], formula (3)\n",
    "    tmp_data = matrix[:, 0:5].copy()\n",
    "    tmp_data[same_index] = 0\n",
    "    (tmp1, tmp2) = (tmp_data, tmp_data.copy())\n",
    "    \n",
    "    # tmp1=molecule; tmp2=denominator\n",
    "    tmp1[diff_index] -= f_mean\n",
    "    tmp2[diff_index] += f_mean\n",
    "    tmp1 = np.sum(np.abs(tmp1), axis=1)\n",
    "    tmp2 = np.sum(np.abs(tmp2), axis=1)\n",
    "    tmp2[tmp2 == 0] = 1.0\n",
    "    d = tmp1 / tmp2\n",
    "    \n",
    "    # calculate placeholder\n",
    "    flag = (d < theta)\n",
    "    matrix[flag, 5] = label\n",
    "    matrix[flag, :5] = 0\n",
    "    matrix[flag, label] = 1\n",
    "    return matrix\n",
    "\n",
    "def filter_denisty(matrix, label, w, h):    \n",
    "    '''\n",
    "    filter_denisty method in paper [11] Sec. 3.3 step4\n",
    "    @matrix=[f1, f2, f3, f4, f5, p, y, texture_quality]\n",
    "    '''\n",
    "    flag = np.where(matrix[:, 5] != label)\n",
    "    matrix = np.reshape(matrix, (h, w, -1))\n",
    "    source_matrix = matrix.copy()\n",
    "    offset = [\n",
    "        [0, 1], [1, 0], [1, 1]\n",
    "    ]\n",
    "    for index in list(flag[0]):\n",
    "        x = int(index % w)\n",
    "        y = int(index / w)\n",
    "        \n",
    "        score, cnt = 0, 0\n",
    "        for p in offset:\n",
    "            _x = x + p[1]\n",
    "            _y = y + p[0]\n",
    "            \n",
    "            # 检测是否在边界，如果不是边界要计算\n",
    "            if (_x >= 0) and (_y >= 0) and (_x < w) and (_y < h):\n",
    "                cnt += 1\n",
    "                # 预测为篡改，得分+1\n",
    "                if source_matrix[_y][_x][5] != label:\n",
    "                    score += 1\n",
    "\n",
    "        # update confidence & label\n",
    "        if score != cnt:\n",
    "            matrix[y, x, :5] = 0\n",
    "            matrix[y, x, label] = 1\n",
    "            matrix[y, x, 5] = label\n",
    "    return np.reshape(matrix, (w*h, -1))\n",
    "\n",
    "def filter_texture(matrix, label, threshold=0.4):\n",
    "    '''\n",
    "    Filter low texture patches, (see paper [11], formula (5))\n",
    "    @matrix=[f1, f2, f3, f4, f5, p, y, texture_quality]\n",
    "    '''\n",
    "    # get placeholder\n",
    "    flag = (matrix[:, 7] < threshold)\n",
    "    matrix[flag, :5] = 0\n",
    "    matrix[flag, label] = 1\n",
    "    return matrix\n",
    "\n",
    "def local_detect_region(data, label, w, h):\n",
    "    '''\n",
    "    Calculate forged region coordinates\n",
    "    @return mark_x, mark_y\n",
    "    @param mark_x=[min_x, max_x], mark_y=[min_y, max_y]\n",
    "    '''\n",
    "    data = np.reshape(data, (h, w, -1))\n",
    "    mark_x, mark_y = [w-1, 0], [h-1, 0]\n",
    "    flag = False\n",
    "    \n",
    "    for j in range(h):\n",
    "        for i in range(w):\n",
    "            if data[j, i, 6] != label:\n",
    "                flag = True\n",
    "                mark_x[0] = min(mark_x[0], i)\n",
    "                mark_x[1] = max(i, mark_x[1])\n",
    "                mark_y[0] = min(mark_y[0], j)\n",
    "                mark_y[1] = max(j, mark_y[1])\n",
    "    if not flag:\n",
    "        mark_x, mark_y = (0, w-1), (0, h-1)\n",
    "    return mark_x, mark_y\n",
    "\n",
    "def local_accuracy(data, label, mark_x, mark_y, w, h):\n",
    "    '''\n",
    "    Calculate local accuracy\n",
    "    '''\n",
    "    area = (mark_x[1] - mark_x[0] + 1) * (mark_y[1] - mark_y[0] + 1)\n",
    "    tmp_data = np.reshape(data, (h, w, -1))[mark_y[0]: mark_y[1], mark_x[0]: mark_x[1], 5:7].copy()\n",
    "    tmp_data = np.reshape(tmp_data, (-1, 2))\n",
    "\n",
    "    same_count = np.sum(np.equal(tmp_data[:, 0], tmp_data[:, 1]))\n",
    "    return same_count, area\n",
    "\n",
    "def show_map(matrix, w, h, label, threshold=0):\n",
    "    '''\n",
    "    show hotmap\n",
    "    @matrix=[f1, f2, f3, f4, f5, p, y]\n",
    "    '''\n",
    "    label_list = np.ones([w*h], dtype=np.int32) * label\n",
    "    predict_list = matrix[0: w*h, 5]\n",
    "    \n",
    "    diff_matrix = np.array(np.abs(label_list - predict_list), dtype=np.bool) * 1\n",
    "    conf_matrix = np.max(matrix[:, 0:5], axis=1)\n",
    "    \n",
    "    list_matrix = np.multiply(conf_matrix, diff_matrix)\n",
    "    list_matrix[list_matrix < threshold] = 0\n",
    "    \n",
    "    plt.clf()\n",
    "    f, ax = plt.subplots(figsize=(16, 10))\n",
    "    xmap = np.reshape(list_matrix, (h, w))\n",
    "    return sns.heatmap(xmap, linewidths=.01, cmap='YlGnBu')\n",
    "\n",
    "def show_binary(matrix, w, h):\n",
    "    '''\n",
    "    show binary hotmap (mask)\n",
    "    @matrix=[f1, f2, f3, f4, f5, p, y]\n",
    "    '''\n",
    "    matrix = np.reshape(matrix, (h, w, -1))\n",
    "    plt.clf()\n",
    "    f, ax = plt.subplots(figsize=(16, 10))\n",
    "    xmap = np.reshape(matrix[:, :, 6], (h, w)).astype(np.int32)\n",
    "    return sns.heatmap(xmap, linewidths=.01, cmap='YlGnBu')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 346,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1 Sony_DSC-H50_0_47035_Agfa_Sensor505-x_0_1674_1540036585_2592_1944.csv\n",
      "=> cnt=0 result=0.5556, 0.9850\n",
      "2 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9407_1540013622_3664_2748.csv\n",
      "=> cnt=1 result=0.5714, 0.9962\n",
      "3 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42268_1540044934_3072_2304.csv\n",
      "=> cnt=2 result=0.8799, 0.9890\n",
      "4 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42309_1540045731_3072_2304.csv\n",
      "=> cnt=3 result=0.7394, 0.9826\n",
      "5 Kodak_M1063_0_9367_Rollei_RCP-7325XS_0_42204_1540044982_3072_2304.csv\n",
      "=> cnt=4 result=0.8000, 0.9977\n",
      "6 Sony_DSC-H50_0_47009_Rollei_RCP-7325XS_0_42216_1540044405_3072_2304.csv\n",
      "=> cnt=5 result=0.7971, 0.9838\n",
      "7 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42306_1540022925_3072_2304.csv\n",
      "=> cnt=6 result=0.7143, 0.9728\n",
      "8 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42219_1540022859_3072_2304.csv\n",
      "=> cnt=7 result=0.1845, 0.9242\n",
      "9 Rollei_RCP-7325XS_0_42267_Sony_DSC-H50_0_47004_1540033882_3456_2592.csv\n",
      "=> cnt=8 result=0.9426, 0.9958\n",
      "10 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42194_1540023187_3072_2304.csv\n",
      "=> cnt=9 result=0.2513, 0.9225\n",
      "11 Rollei_RCP-7325XS_0_42262_Sony_DSC-H50_0_46972_1540034454_3456_2592.csv\n",
      "=> cnt=10 result=0.9463, 0.9894\n",
      "12 Sony_DSC-H50_0_47031_Agfa_Sensor505-x_0_1680_1540035609_2592_1944.csv\n",
      "=> cnt=11 result=0.8296, 1.0000\n",
      "13 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9367_1540014001_3664_2748.csv\n",
      "=> cnt=12 result=0.6000, 0.9962\n",
      "14 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9409_1540016770_3664_2748.csv\n",
      "=> cnt=13 result=0.6000, 0.9962\n",
      "15 Agfa_Sensor505-x_0_1862_Kodak_M1063_0_9542_1540014306_3664_2748.csv\n",
      "=> cnt=14 result=0.7455, 0.9979\n",
      "16 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42322_1540045771_3072_2304.csv\n",
      "=> cnt=15 result=0.7722, 0.9867\n",
      "17 Agfa_Sensor505-x_0_1667_Kodak_M1063_0_9385_1540014021_2748_3664.csv\n",
      "=> cnt=16 result=0.6296, 0.9954\n",
      "18 Kodak_M1063_0_9457_Nikon_D200_0_14908_1540041581_3872_2592.csv\n",
      "=> cnt=17 result=0.8160, 0.9117\n",
      "19 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42307_1540043940_3072_2304.csv\n",
      "=> cnt=18 result=0.7054, 0.9873\n",
      "20 Agfa_Sensor505-x_0_1629_Kodak_M1063_0_9393_1540016753_3664_2748.csv\n",
      "=> cnt=19 result=0.9307, 0.9996\n",
      "21 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42323_1540046188_3072_2304.csv\n",
      "=> cnt=20 result=0.7867, 0.9942\n",
      "22 Nikon_D200_0_15026_Kodak_M1063_0_9532_1540040503_3664_2748.csv\n",
      "=> cnt=21 result=0.8214, 0.9916\n",
      "23 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1627_1540037219_2592_1944.csv\n",
      "=> cnt=22 result=0.6889, 0.9992\n",
      "24 Sony_DSC-H50_0_47004_Agfa_Sensor505-x_0_1673_1540037066_2592_1944.csv\n",
      "=> cnt=23 result=0.5172, 0.9792\n",
      "25 Nikon_D200_0_15026_Kodak_M1063_0_9538_1540040290_3664_2748.csv\n",
      "=> cnt=24 result=0.8256, 0.9921\n",
      "26 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1629_1540037246_2592_1944.csv\n",
      "=> cnt=25 result=0.9171, 0.9958\n",
      "27 Nikon_D200_0_15026_Kodak_M1063_0_9464_1540040419_2748_3664.csv\n",
      "=> cnt=26 result=0.8269, 0.9887\n",
      "28 Nikon_D200_0_15026_Kodak_M1063_0_9532_1540040650_3664_2748.csv\n",
      "=> cnt=27 result=0.8000, 0.9904\n",
      "29 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1625_1540036968_2592_1944.csv\n",
      "=> cnt=28 result=0.8452, 0.9967\n",
      "30 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42207_1540042602_3072_2304.csv\n",
      "=> cnt=29 result=0.8459, 0.9919\n",
      "31 Sony_DSC-H50_0_47032_Agfa_Sensor505-x_0_1673_1540036483_2592_1944.csv\n",
      "=> cnt=30 result=0.6731, 0.9850\n",
      "32 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42215_1540023061_3072_2304.csv\n",
      "=> cnt=31 result=0.0759, 0.8953\n",
      "33 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42220_1540046000_3072_2304.csv\n",
      "=> cnt=32 result=0.8287, 0.9803\n",
      "34 Sony_DSC-H50_0_47004_Rollei_RCP-7325XS_0_42215_1540044385_3072_2304.csv\n",
      "=> cnt=33 result=0.7926, 0.9786\n",
      "35 Sony_DSC-H50_0_47031_Agfa_Sensor505-x_0_1629_1540036457_2592_1944.csv\n",
      "=> cnt=34 result=0.8882, 0.9775\n",
      "36 Nikon_D200_0_14902_Rollei_RCP-7325XS_0_42185_1540022146_3072_2304.csv\n",
      "=> cnt=35 result=0.7536, 0.9850\n",
      "37 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42203_1540022776_3072_2304.csv\n",
      "=> cnt=36 result=0.8647, 0.9948\n",
      "38 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42306_1540022339_3072_2304.csv\n",
      "=> cnt=37 result=0.8187, 0.9861\n",
      "39 Nikon_D200_0_15026_Kodak_M1063_0_9532_1540040266_3664_2748.csv\n",
      "=> cnt=38 result=0.7560, 0.9887\n",
      "40 Sony_DSC-H50_0_46998_Agfa_Sensor505-x_0_1806_1540035958_2592_1944.csv\n",
      "=> cnt=39 result=0.4667, 0.9467\n",
      "41 Kodak_M1063_0_9375_Nikon_D200_0_14908_1540019187_3872_2592.csv\n",
      "=> cnt=40 result=0.8744, 0.9875\n",
      "42 Nikon_D200_0_15026_Kodak_M1063_0_9489_1540040235_3664_2748.csv\n",
      "=> cnt=41 result=0.8154, 0.9908\n",
      "43 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42194_1540022988_3072_2304.csv\n",
      "=> cnt=42 result=0.5938, 0.9265\n",
      "44 Agfa_Sensor505-x_0_1783_Kodak_M1063_0_9468_1540016550_3664_2748.csv\n",
      "=> cnt=43 result=0.9566, 0.9975\n",
      "45 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42220_1540046501_3072_2304.csv\n",
      "=> cnt=44 result=0.8061, 0.9896\n",
      "46 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42204_1540046915_3072_2304.csv\n",
      "=> cnt=45 result=0.8121, 0.9896\n",
      "47 Nikon_D200_0_14902_Kodak_M1063_0_9393_1540040138_3664_2748.csv\n",
      "=> cnt=46 result=0.9032, 0.9900\n",
      "48 Sony_DSC-H50_0_47004_Agfa_Sensor505-x_0_1830_1540036334_2592_1944.csv\n",
      "=> cnt=47 result=0.4483, 0.9675\n",
      "49 Nikon_D200_0_14908_Kodak_M1063_0_9393_1540041538_3664_2748.csv\n",
      "=> cnt=48 result=0.9128, 0.9933\n",
      "50 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42218_1540022852_3072_2304.csv\n",
      "=> cnt=49 result=0.1378, 0.9126\n",
      "51 Kodak_M1063_0_9564_Nikon_D200_0_15062_1540018913_3872_2592.csv\n",
      "=> cnt=50 result=0.5139, 0.9900\n",
      "52 Agfa_Sensor505-x_0_1857_Kodak_M1063_0_9409_1540128878_3664_2748.csv\n",
      "=> cnt=51 result=0.7812, 0.9975\n",
      "53 Nikon_D200_0_15135_Rollei_RCP-7325XS_0_42262_1540023296_3072_2304.csv\n",
      "=> cnt=52 result=0.7800, 0.9797\n",
      "54 Kodak_M1063_0_9367_Rollei_RCP-7325XS_0_42203_1540044720_3072_2304.csv\n",
      "=> cnt=53 result=0.7778, 0.9844\n",
      "55 Sony_DSC-H50_0_47035_Agfa_Sensor505-x_0_1675_1540036593_2592_1944.csv\n",
      "=> cnt=54 result=0.6212, 0.9883\n",
      "56 Kodak_M1063_0_9579_Rollei_RCP-7325XS_0_42204_1540046979_3072_2304.csv\n",
      "=> cnt=55 result=0.8413, 0.9936\n",
      "57 Kodak_M1063_0_9534_Nikon_D200_0_15012_1540019588_3872_2592.csv\n",
      "=> cnt=56 result=0.5962, 0.9925\n",
      "58 Kodak_M1063_0_9555_Nikon_D200_0_15046_1540019627_3872_2592.csv\n",
      "=> cnt=57 result=0.6643, 0.9829\n",
      "59 Rollei_RCP-7325XS_0_42359_Sony_DSC-H50_0_47004_1540034825_3456_2592.csv\n",
      "=> cnt=58 result=0.7182, 0.9889\n",
      "60 Agfa_Sensor505-x_0_1811_Kodak_M1063_0_9500_1540014213_3664_2748.csv\n",
      "=> cnt=59 result=0.7000, 0.9992\n",
      "61 Kodak_M1063_0_9555_Nikon_D200_0_15038_1540018863_3872_2592.csv\n",
      "=> cnt=60 result=0.6500, 0.9912\n",
      "62 Kodak_M1063_0_9596_Rollei_RCP-7325XS_0_42314_1540046646_3072_2304.csv\n",
      "=> cnt=61 result=0.7333, 0.9850\n",
      "63 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42216_1540023068_3072_2304.csv\n",
      "=> cnt=62 result=0.8182, 0.9850\n",
      "64 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9555_1540013896_3664_2748.csv\n",
      "=> cnt=63 result=0.6333, 0.9971\n",
      "65 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46910_1540034299_3456_2592.csv\n",
      "=> cnt=64 result=0.9176, 0.9972\n",
      "66 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42218_1540042801_3072_2304.csv\n",
      "=> cnt=65 result=0.7054, 0.9878\n",
      "67 Sony_DSC-H50_0_46908_Agfa_Sensor505-x_0_1709_1540036840_2592_1944.csv\n",
      "=> cnt=66 result=0.6250, 0.9900\n",
      "68 Agfa_Sensor505-x_0_1858_Kodak_M1063_0_9542_1540017051_3664_2748.csv\n",
      "=> cnt=67 result=0.8455, 0.9937\n",
      "69 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47030_1540028261_3456_2592.csv\n",
      "=> cnt=68 result=0.8542, 0.9921\n",
      "70 Kodak_M1063_0_9596_Rollei_RCP-7325XS_0_42203_1540046691_3072_2304.csv\n",
      "=> cnt=69 result=0.7879, 0.9948\n",
      "71 Nikon_D200_0_15026_Kodak_M1063_0_9531_1540040870_3664_2748.csv\n",
      "=> cnt=70 result=0.8095, 0.9908\n",
      "72 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1628_1540037231_2592_1944.csv\n",
      "=> cnt=71 result=0.9184, 0.9967\n",
      "73 Kodak_M1063_0_9457_Nikon_D200_0_14952_1540018721_3872_2592.csv\n",
      "=> cnt=72 result=0.1652, 0.9246\n",
      "74 Nikon_D200_0_15022_Kodak_M1063_0_9406_1540040371_3664_2748.csv\n",
      "=> cnt=73 result=0.8286, 0.9845\n",
      "75 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9385_1540014381_2748_3664.csv\n",
      "=> cnt=74 result=0.6571, 0.9975\n",
      "76 Nikon_D200_0_15026_Kodak_M1063_0_9529_1540040856_3664_2748.csv\n",
      "=> cnt=75 result=0.8359, 0.9891\n",
      "77 Nikon_D200_0_15026_Kodak_M1063_0_9534_1540040275_3664_2748.csv\n",
      "=> cnt=76 result=0.7308, 0.9850\n",
      "78 Kodak_M1063_0_9457_Nikon_D200_0_15008_1540019238_3872_2592.csv\n",
      "=> cnt=77 result=0.8000, 0.9929\n",
      "79 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46912_1540027990_3456_2592.csv\n",
      "=> cnt=78 result=0.8000, 0.9907\n",
      "80 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47021_1540034577_3456_2592.csv\n",
      "=> cnt=79 result=0.8444, 0.9949\n",
      "81 Kodak_M1063_0_9585_Nikon_D200_0_15070_1540019711_3872_2592.csv\n",
      "=> cnt=80 result=0.8400, 0.9908\n",
      "82 Kodak_M1063_0_9403_Nikon_D200_0_14908_1540017887_3872_2592.csv\n",
      "=> cnt=81 result=0.9358, 0.9925\n",
      "83 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42204_1540023016_3072_2304.csv\n",
      "=> cnt=82 result=0.8700, 0.9838\n",
      "84 Kodak_M1063_0_9557_Nikon_D200_0_15078_1540018382_3872_2592.csv\n",
      "=> cnt=83 result=0.0804, 0.9163\n",
      "85 Kodak_M1063_0_9585_Rollei_RCP-7325XS_0_42307_1540046614_3072_2304.csv\n",
      "=> cnt=84 result=0.8068, 0.9907\n",
      "86 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1905_1540036389_2592_1944.csv\n",
      "=> cnt=85 result=0.7032, 0.9792\n",
      "87 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42204_1540045838_3072_2304.csv\n",
      "=> cnt=86 result=0.7952, 0.9838\n",
      "88 Kodak_M1063_0_9489_Nikon_D200_0_15012_1540106251_3872_2592.csv\n",
      "=> cnt=87 result=0.8042, 0.9846\n",
      "89 Nikon_D200_0_15026_Kodak_M1063_0_9546_1540040906_3664_2748.csv\n",
      "=> cnt=88 result=0.8435, 0.9942\n",
      "90 Kodak_M1063_0_9583_Nikon_D200_0_15056_1540019681_3872_2592.csv\n",
      "=> cnt=89 result=0.8205, 0.9929\n",
      "91 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42204_1540042586_3072_2304.csv\n",
      "=> cnt=90 result=0.7679, 0.9902\n",
      "92 Kodak_M1063_0_9579_Nikon_D200_0_14908_1540130311_3872_2592.csv\n",
      "=> cnt=91 result=0.9370, 0.9942\n",
      "93 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42203_1540023000_3072_2304.csv\n",
      "=> cnt=92 result=0.7851, 0.9954\n",
      "94 Kodak_M1063_0_9457_Nikon_D200_0_14908_1540106631_3872_2592.csv\n",
      "=> cnt=93 result=0.9346, 0.9917\n",
      "95 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42222_1540046512_3072_2304.csv\n",
      "=> cnt=94 result=0.7889, 0.9884\n",
      "96 Nikon_D200_0_14908_Kodak_M1063_0_9457_1540039923_2748_3664.csv\n",
      "=> cnt=95 result=0.7886, 0.9883\n",
      "97 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42218_1540022255_3072_2304.csv\n",
      "=> cnt=96 result=0.2253, 0.9271\n",
      "98 Agfa_Sensor505-x_0_1859_Kodak_M1063_0_9540_1540014292_3664_2748.csv\n",
      "=> cnt=97 result=0.6286, 0.9958\n",
      "99 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1633_1540035263_2592_1944.csv\n",
      "=> cnt=98 result=0.6774, 0.9758\n",
      "100 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42236_1540023138_3072_2304.csv\n",
      "=> cnt=99 result=0.8496, 0.9907\n",
      "101 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_47012_1540034877_3456_2592.csv\n",
      "=> cnt=100 result=0.8381, 0.9931\n",
      "102 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1628_1540107258_2592_1944.csv\n",
      "=> cnt=101 result=0.9013, 0.9858\n",
      "103 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42215_1540042469_3072_2304.csv\n",
      "=> cnt=102 result=0.7396, 0.9907\n",
      "104 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_46949_1540023584_3456_2592.csv\n",
      "=> cnt=103 result=0.8684, 0.9949\n",
      "105 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1876_1540036364_2592_1944.csv\n",
      "=> cnt=104 result=0.7250, 0.9800\n",
      "106 Nikon_D200_0_15026_Kodak_M1063_0_9537_1540040284_3664_2748.csv\n",
      "=> cnt=105 result=0.8077, 0.9900\n",
      "107 Agfa_Sensor505-x_0_1826_Kodak_M1063_0_9476_1540016976_3664_2748.csv\n",
      "=> cnt=106 result=0.6354, 0.9916\n",
      "108 Agfa_Sensor505-x_0_1667_Kodak_M1063_0_9557_1540013920_3664_2748.csv\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=> cnt=107 result=0.6481, 0.9962\n",
      "109 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42218_1540045930_3072_2304.csv\n",
      "=> cnt=108 result=0.8571, 0.9913\n",
      "110 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_47004_1540028207_3456_2592.csv\n",
      "=> cnt=109 result=0.8133, 0.9944\n",
      "111 Kodak_M1063_0_9406_Nikon_D200_0_15008_1540018510_3872_2592.csv\n",
      "=> cnt=110 result=0.6667, 0.9992\n",
      "112 Nikon_D200_0_15026_Kodak_M1063_0_9470_1540040429_3664_2748.csv\n",
      "=> cnt=111 result=0.8586, 0.9908\n",
      "113 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42203_1540023220_3072_2304.csv\n",
      "=> cnt=112 result=0.8529, 0.9919\n",
      "114 Sony_DSC-H50_0_46912_Agfa_Sensor505-x_0_1620_1540036933_2592_1944.csv\n",
      "=> cnt=113 result=0.7444, 0.9817\n",
      "115 Agfa_Sensor505-x_0_1796_Kodak_M1063_0_9407_1540014147_3664_2748.csv\n",
      "=> cnt=114 result=0.4167, 0.9975\n",
      "116 Agfa_Sensor505-x_0_1695_Kodak_M1063_0_9385_1540014092_2748_3664.csv\n",
      "=> cnt=115 result=0.5000, 1.0000\n",
      "117 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1788_1540036890_2592_1944.csv\n",
      "=> cnt=116 result=0.8571, 0.9975\n",
      "118 Sony_DSC-H50_0_47447_Agfa_Sensor505-x_0_1796_1540035876_2592_1944.csv\n",
      "=> cnt=117 result=0.5857, 0.9825\n",
      "119 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42208_1540042255_3072_2304.csv\n",
      "=> cnt=118 result=0.7083, 0.9821\n",
      "120 Agfa_Sensor505-x_0_1857_Kodak_M1063_0_9540_1540017019_3664_2748.csv\n",
      "=> cnt=119 result=0.7500, 0.9950\n",
      "121 Sony_DSC-H50_0_47413_Rollei_RCP-7325XS_0_42204_1540044189_3072_2304.csv\n",
      "=> cnt=120 result=0.7571, 0.9913\n",
      "122 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42220_1540042288_3072_2304.csv\n",
      "=> cnt=121 result=0.6606, 0.9838\n",
      "123 Agfa_Sensor505-x_0_1783_Kodak_M1063_0_9409_1540017720_3664_2748.csv\n",
      "=> cnt=122 result=0.5938, 0.9967\n",
      "124 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_46927_1540023540_3456_2592.csv\n",
      "=> cnt=123 result=0.9018, 0.9935\n",
      "125 Nikon_D200_0_15026_Kodak_M1063_0_9538_1540040681_3664_2748.csv\n",
      "=> cnt=124 result=0.8269, 0.9900\n",
      "126 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47009_1540034551_3456_2592.csv\n",
      "=> cnt=125 result=0.9241, 0.9917\n",
      "127 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42220_1540044876_3072_2304.csv\n",
      "=> cnt=126 result=0.7500, 0.9925\n",
      "128 Agfa_Sensor505-x_0_1695_Kodak_M1063_0_9406_1540016503_3664_2748.csv\n",
      "=> cnt=127 result=0.7792, 0.9954\n",
      "129 Kodak_M1063_0_9457_Nikon_D200_0_15062_1540106699_3872_2592.csv\n",
      "=> cnt=128 result=0.8739, 0.9912\n",
      "130 Sony_DSC-H50_0_47035_Agfa_Sensor505-x_0_1684_1540035675_2592_1944.csv\n",
      "=> cnt=129 result=0.4545, 0.9825\n",
      "131 Nikon_D200_0_15026_Kodak_M1063_0_9531_1540040497_3664_2748.csv\n",
      "=> cnt=130 result=0.8000, 0.9875\n",
      "132 Rollei_RCP-7325XS_0_42375_Sony_DSC-H50_0_47024_1540034598_3456_2592.csv\n",
      "=> cnt=131 result=0.8344, 0.9921\n",
      "133 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42307_1540022935_3072_2304.csv\n",
      "=> cnt=132 result=0.3385, 0.9329\n",
      "134 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1794_1540036907_2592_1944.csv\n",
      "=> cnt=133 result=0.8250, 1.0000\n",
      "135 Sony_DSC-H50_0_47447_Rollei_RCP-7325XS_0_42214_1540042779_3072_2304.csv\n",
      "=> cnt=134 result=0.7013, 0.9942\n",
      "136 Sony_DSC-H50_0_47004_Rollei_RCP-7325XS_0_42323_1540044036_3072_2304.csv\n",
      "=> cnt=135 result=0.6023, 0.9439\n",
      "137 Agfa_Sensor505-x_0_1800_Kodak_M1063_0_9409_1540014488_3664_2748.csv\n",
      "=> cnt=136 result=0.6458, 0.9962\n",
      "138 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42267_1540023308_3072_2304.csv\n",
      "=> cnt=137 result=0.8700, 0.9873\n",
      "139 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42209_1540042627_3072_2304.csv\n",
      "=> cnt=138 result=0.7857, 0.9907\n",
      "140 Rollei_RCP-7325XS_0_42250_Sony_DSC-H50_0_46970_1540033793_3456_2592.csv\n",
      "=> cnt=139 result=0.7654, 0.9833\n",
      "141 Kodak_M1063_0_9375_Nikon_D200_0_14906_1540017861_3872_2592.csv\n",
      "=> cnt=140 result=0.8476, 0.9825\n",
      "142 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42204_1540023229_3072_2304.csv\n",
      "=> cnt=141 result=0.8597, 0.9925\n",
      "143 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1622_1540036956_2592_1944.csv\n",
      "=> cnt=142 result=0.7639, 0.9867\n",
      "144 Nikon_D200_0_15026_Kodak_M1063_0_9540_1540040689_3664_2748.csv\n",
      "=> cnt=143 result=0.8137, 0.9887\n",
      "145 Sony_DSC-H50_0_46953_Agfa_Sensor505-x_0_1629_1540037015_2592_1944.csv\n",
      "=> cnt=144 result=0.9224, 0.9992\n",
      "146 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47004_1540034541_3456_2592.csv\n",
      "=> cnt=145 result=0.8548, 0.9769\n",
      "147 Nikon_D200_0_15026_Kodak_M1063_0_9457_1540040217_2748_3664.csv\n",
      "=> cnt=146 result=0.8167, 0.9883\n",
      "148 Kodak_M1063_0_9403_Nikon_D200_0_15006_1540018496_3872_2592.csv\n",
      "=> cnt=147 result=0.6875, 0.9975\n",
      "149 Rollei_RCP-7325XS_0_42250_Sony_DSC-H50_0_46972_1540028163_3456_2592.csv\n",
      "=> cnt=148 result=0.9199, 0.9630\n",
      "150 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42222_1540042297_3072_2304.csv\n",
      "=> cnt=149 result=0.7109, 0.9855\n",
      "151 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46912_1540041502_3456_2592.csv\n",
      "=> cnt=150 result=0.7619, 0.9944\n",
      "152 Agfa_Sensor505-x_0_1800_Kodak_M1063_0_9470_1540016569_3664_2748.csv\n",
      "=> cnt=151 result=0.8694, 0.9958\n",
      "153 Agfa_Sensor505-x_0_1806_Kodak_M1063_0_9409_1540014174_3664_2748.csv\n",
      "=> cnt=152 result=0.5000, 0.9987\n",
      "154 Kodak_M1063_0_9367_Nikon_D200_0_14902_1540018974_3872_2592.csv\n",
      "=> cnt=153 result=0.0088, 0.9533\n",
      "155 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42222_1540023120_3072_2304.csv\n",
      "=> cnt=154 result=0.8449, 0.9919\n",
      "156 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46912_1540034707_3456_2592.csv\n",
      "=> cnt=155 result=0.8357, 0.9903\n",
      "157 Kodak_M1063_0_9525_Nikon_D200_0_15046_1540018343_3872_2592.csv\n",
      "=> cnt=156 result=0.7870, 0.9958\n",
      "158 Agfa_Sensor505-x_0_1821_Kodak_M1063_0_9476_1540014540_3664_2748.csv\n",
      "=> cnt=157 result=0.5000, 0.9950\n",
      "159 Agfa_Sensor505-x_0_1783_Kodak_M1063_0_9393_1540014425_3664_2748.csv\n",
      "=> cnt=158 result=0.9307, 0.9996\n",
      "160 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42215_1540042646_3072_2304.csv\n",
      "=> cnt=159 result=0.7667, 0.9890\n",
      "161 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42220_1540023260_3072_2304.csv\n",
      "=> cnt=160 result=0.8342, 0.9884\n",
      "162 Nikon_D200_0_15026_Kodak_M1063_0_9407_1540040381_3664_2748.csv\n",
      "=> cnt=161 result=0.8308, 0.9883\n",
      "163 Agfa_Sensor505-x_0_1858_Kodak_M1063_0_9559_1540017078_3664_2748.csv\n",
      "=> cnt=162 result=0.7532, 0.9958\n",
      "164 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46972_1540033807_3456_2592.csv\n",
      "=> cnt=163 result=0.9150, 0.9681\n",
      "165 Kodak_M1063_0_9367_Nikon_D200_0_14902_1540019762_3872_2592.csv\n",
      "=> cnt=164 result=0.7619, 0.9929\n",
      "166 Nikon_D200_0_15026_Kodak_M1063_0_9409_1540040194_3664_2748.csv\n",
      "=> cnt=165 result=0.8269, 0.9887\n",
      "167 Nikon_D200_0_15157_Rollei_RCP-7325XS_0_42306_1540022615_3072_2304.csv\n",
      "=> cnt=166 result=0.7836, 0.9896\n",
      "168 Nikon_D200_0_15026_Kodak_M1063_0_9410_1540040201_3664_2748.csv\n",
      "=> cnt=167 result=0.8154, 0.9891\n",
      "169 Nikon_D200_0_15026_Kodak_M1063_0_9555_1540040716_3664_2748.csv\n",
      "=> cnt=168 result=0.8365, 0.9937\n",
      "170 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42207_1540042248_3072_2304.csv\n",
      "=> cnt=169 result=0.7200, 0.9855\n",
      "171 Nikon_D200_0_15026_Kodak_M1063_0_9537_1540040673_3664_2748.csv\n",
      "=> cnt=170 result=0.7769, 0.9950\n",
      "172 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42203_1540042176_3072_2304.csv\n",
      "=> cnt=171 result=0.8154, 0.9988\n",
      "173 Nikon_D200_0_14908_Kodak_M1063_0_9491_1540040794_3664_2748.csv\n",
      "=> cnt=172 result=0.9407, 0.9887\n",
      "174 Kodak_M1063_0_9557_Nikon_D200_0_15072_1540019350_3872_2592.csv\n",
      "=> cnt=173 result=0.2424, 0.9421\n",
      "175 Agfa_Sensor505-x_0_1820_Kodak_M1063_0_9457_1540016920_2748_3664.csv\n",
      "=> cnt=174 result=0.5333, 0.9962\n",
      "176 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42306_1540043924_3072_2304.csv\n",
      "=> cnt=175 result=0.7524, 0.9913\n",
      "177 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42218_1540044834_3072_2304.csv\n",
      "=> cnt=176 result=0.8182, 0.9873\n",
      "178 Kodak_M1063_0_9559_Rollei_RCP-7325XS_0_42208_1540046423_3072_2304.csv\n",
      "=> cnt=177 result=0.7475, 0.9907\n",
      "179 Sony_DSC-H50_0_47004_Rollei_RCP-7325XS_0_42205_1540042227_3072_2304.csv\n",
      "=> cnt=178 result=0.9172, 1.0000\n",
      "180 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_47027_1540034607_3456_2592.csv\n",
      "=> cnt=179 result=0.8325, 0.9963\n",
      "181 Nikon_D200_0_15050_Rollei_RCP-7325XS_0_42205_1540022818_3072_2304.csv\n",
      "=> cnt=180 result=0.9121, 0.9983\n",
      "182 Nikon_D200_0_14902_Rollei_RCP-7325XS_0_42216_1540022463_3072_2304.csv\n",
      "=> cnt=181 result=0.7543, 0.9861\n",
      "183 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1627_1540036071_2592_1944.csv\n",
      "=> cnt=182 result=0.7385, 0.9858\n",
      "184 Agfa_Sensor505-x_0_1857_Kodak_M1063_0_9584_1540017107_3664_2748.csv\n",
      "=> cnt=183 result=0.7812, 0.9954\n",
      "185 Nikon_D200_0_14908_Kodak_M1063_0_9406_1540038194_3664_2748.csv\n",
      "=> cnt=184 result=0.7800, 0.9929\n",
      "186 Nikon_D200_0_15026_Kodak_M1063_0_9525_1540040626_3664_2748.csv\n",
      "=> cnt=185 result=0.8125, 0.9871\n",
      "187 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42220_1540042501_3072_2304.csv\n",
      "=> cnt=186 result=0.8167, 0.9977\n",
      "188 Sony_DSC-H50_0_47035_Rollei_RCP-7325XS_0_42205_1540042732_3072_2304.csv\n",
      "=> cnt=187 result=0.9172, 1.0000\n",
      "189 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9393_1540016447_3664_2748.csv\n",
      "=> cnt=188 result=0.9271, 0.9983\n",
      "190 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42218_1540023251_3072_2304.csv\n",
      "=> cnt=189 result=0.8611, 0.9919\n",
      "191 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47012_1540034025_3456_2592.csv\n",
      "=> cnt=190 result=0.9417, 0.9907\n",
      "192 Nikon_D200_0_15050_Rollei_RCP-7325XS_0_42316_1540022354_3072_2304.csv\n",
      "=> cnt=191 result=0.7407, 0.9954\n",
      "193 Kodak_M1063_0_9525_Nikon_D200_0_15012_1540128765_3872_2592.csv\n",
      "=> cnt=192 result=0.3259, 0.8871\n",
      "194 Kodak_M1063_0_9367_Nikon_D200_0_14906_1540018638_3872_2592.csv\n",
      "=> cnt=193 result=0.6731, 0.9600\n",
      "195 Sony_DSC-H50_0_47408_Agfa_Sensor505-x_0_1683_1540036634_2592_1944.csv\n",
      "=> cnt=194 result=0.7070, 0.9483\n",
      "196 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9403_1540013606_3664_2748.csv\n",
      "=> cnt=195 result=0.6000, 0.9967\n",
      "197 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42218_1540046473_3072_2304.csv\n",
      "=> cnt=196 result=0.8000, 0.9884\n",
      "198 Nikon_D200_0_15026_Kodak_M1063_0_9529_1540040489_3664_2748.csv\n",
      "=> cnt=197 result=0.7857, 0.9879\n",
      "199 Nikon_D200_0_15026_Kodak_M1063_0_9409_1540040391_3664_2748.csv\n",
      "=> cnt=198 result=0.8256, 0.9904\n",
      "200 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42222_1540022878_3072_2304.csv\n",
      "=> cnt=199 result=0.1889, 0.9207\n",
      "201 Kodak_M1063_0_9367_Nikon_D200_0_14906_1540018426_3872_2592.csv\n",
      "=> cnt=200 result=0.7455, 0.9592\n",
      "202 Nikon_D200_0_15026_Kodak_M1063_0_9531_1540040257_3664_2748.csv\n",
      "=> cnt=201 result=0.7714, 0.9862\n",
      "203 Nikon_D200_0_15026_Kodak_M1063_0_9534_1540040662_3664_2748.csv\n",
      "=> cnt=202 result=0.8205, 0.9916\n",
      "204 Sony_DSC-H50_0_47413_Rollei_RCP-7325XS_0_42273_1540043864_3072_2304.csv\n",
      "=> cnt=203 result=0.9124, 0.9826\n",
      "205 Kodak_M1063_0_9579_Rollei_RCP-7325XS_0_42204_1540046961_3072_2304.csv\n",
      "=> cnt=204 result=0.7765, 0.9711\n",
      "206 Kodak_M1063_0_9457_Nikon_D200_0_15074_1540106718_3872_2592.csv\n",
      "=> cnt=205 result=0.1550, 0.8829\n",
      "207 Sony_DSC-H50_0_47030_Agfa_Sensor505-x_0_1673_1540035299_2592_1944.csv\n",
      "=> cnt=206 result=0.8262, 0.9608\n",
      "208 Sony_DSC-H50_0_46968_Rollei_RCP-7325XS_0_42214_1540044352_3072_2304.csv\n",
      "=> cnt=207 result=0.5600, 0.9867\n",
      "209 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42208_1540042608_3072_2304.csv\n",
      "=> cnt=208 result=0.8304, 0.9942\n",
      "210 Kodak_M1063_0_9559_Nikon_D200_0_15052_1540019649_3872_2592.csv\n",
      "=> cnt=209 result=0.6250, 0.9975\n",
      "211 Sony_DSC-H50_0_47447_Agfa_Sensor505-x_0_1702_1540036274_2592_1944.csv\n",
      "=> cnt=210 result=0.7143, 0.9867\n",
      "212 Kodak_M1063_0_9457_Nikon_D200_0_15008_1540018767_3872_2592.csv\n",
      "=> cnt=211 result=0.1270, 0.9550\n",
      "213 Kodak_M1063_0_9457_Nikon_D200_0_15072_1540106710_3872_2592.csv\n",
      "=> cnt=212 result=0.8787, 0.9908\n",
      "214 Agfa_Sensor505-x_0_1778_Kodak_M1063_0_9409_1540016530_3664_2748.csv\n",
      "=> cnt=213 result=0.6000, 1.0000\n",
      "215 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42236_1540023278_3072_2304.csv\n",
      "=> cnt=214 result=0.8534, 0.9919\n",
      "216 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42215_1540045888_3072_2304.csv\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=> cnt=215 result=0.7443, 0.9821\n",
      "217 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42222_1540022516_3072_2304.csv\n",
      "=> cnt=216 result=0.0128, 0.9161\n",
      "218 Kodak_M1063_0_9457_Nikon_D200_0_14984_1540106210_3872_2592.csv\n",
      "=> cnt=217 result=0.8615, 0.9933\n",
      "219 Sony_DSC-H50_0_47032_Agfa_Sensor505-x_0_1681_1540035625_2592_1944.csv\n",
      "=> cnt=218 result=0.8170, 0.9850\n",
      "220 Agfa_Sensor505-x_0_1667_Kodak_M1063_0_9409_1540013657_3664_2748.csv\n",
      "=> cnt=219 result=0.5758, 0.9946\n",
      "221 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42220_1540022267_3072_2304.csv\n",
      "=> cnt=220 result=0.2615, 0.9508\n",
      "222 Nikon_D200_0_15135_Rollei_RCP-7325XS_0_42362_1540022396_3072_2304.csv\n",
      "=> cnt=221 result=0.7143, 0.9797\n",
      "223 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42319_1540045760_3072_2304.csv\n",
      "=> cnt=222 result=0.8333, 0.9936\n",
      "224 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47012_1540034567_3456_2592.csv\n",
      "=> cnt=223 result=0.9348, 0.9894\n",
      "225 Nikon_D200_0_15026_Kodak_M1063_0_9531_1540040642_3664_2748.csv\n",
      "=> cnt=224 result=0.8221, 0.9916\n",
      "226 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42306_1540023333_3072_2304.csv\n",
      "=> cnt=225 result=0.8624, 0.9821\n",
      "227 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42220_1540022871_3072_2304.csv\n",
      "=> cnt=226 result=0.4405, 0.9531\n",
      "228 Nikon_D200_0_15026_Kodak_M1063_0_9571_1540040736_3664_2748.csv\n",
      "=> cnt=227 result=0.8170, 0.9912\n",
      "229 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42207_1540044788_3072_2304.csv\n",
      "=> cnt=228 result=0.8121, 0.9867\n",
      "230 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42219_1540044857_3072_2304.csv\n",
      "=> cnt=229 result=0.8160, 0.9821\n",
      "231 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42314_1540043952_3072_2304.csv\n",
      "=> cnt=230 result=0.8532, 0.9948\n",
      "232 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42205_1540023030_3072_2304.csv\n",
      "=> cnt=231 result=0.9172, 1.0000\n",
      "233 Kodak_M1063_0_9559_Nikon_D200_0_15074_1540019364_3872_2592.csv\n",
      "=> cnt=232 result=0.7222, 0.9946\n",
      "234 Kodak_M1063_0_9557_Nikon_D200_0_15012_1540130220_3872_2592.csv\n",
      "=> cnt=233 result=0.2611, 0.8929\n",
      "235 Kodak_M1063_0_9555_Nikon_D200_0_15064_1540019330_3872_2592.csv\n",
      "=> cnt=234 result=0.2857, 0.9613\n",
      "236 Kodak_M1063_0_9557_Rollei_RCP-7325XS_0_42306_1540046113_3072_2304.csv\n",
      "=> cnt=235 result=0.7610, 0.9711\n",
      "237 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42218_1540042271_3072_2304.csv\n",
      "=> cnt=236 result=0.6645, 0.9815\n",
      "238 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42204_1540044752_3072_2304.csv\n",
      "=> cnt=237 result=0.7833, 0.9873\n",
      "239 Kodak_M1063_0_9457_Nikon_D200_0_14932_1540017940_3872_2592.csv\n",
      "=> cnt=238 result=0.8034, 0.9933\n",
      "240 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47009_1540034014_3456_2592.csv\n",
      "=> cnt=239 result=0.9300, 0.9931\n",
      "241 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42204_1540042717_3072_2304.csv\n",
      "=> cnt=240 result=0.6937, 0.9861\n",
      "242 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42218_1540042485_3072_2304.csv\n",
      "=> cnt=241 result=0.6875, 0.9884\n",
      "243 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1629_1540035488_2592_1944.csv\n",
      "=> cnt=242 result=0.8697, 0.9658\n",
      "244 Sony_DSC-H50_0_47035_Agfa_Sensor505-x_0_1674_1540037083_2592_1944.csv\n",
      "=> cnt=243 result=0.5909, 0.9875\n",
      "245 Nikon_D200_0_15026_Kodak_M1063_0_9578_1540040928_3664_2748.csv\n",
      "=> cnt=244 result=0.8143, 0.9942\n",
      "246 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1674_1540035525_2592_1944.csv\n",
      "=> cnt=245 result=0.6797, 0.9825\n",
      "247 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46968_1540023653_3456_2592.csv\n",
      "=> cnt=246 result=0.7639, 0.9935\n",
      "248 Agfa_Sensor505-x_0_1796_Kodak_M1063_0_9407_1540014477_3664_2748.csv\n",
      "=> cnt=247 result=0.6061, 0.9950\n",
      "249 Rollei_RCP-7325XS_0_42207_Sony_DSC-H50_0_47027_1540034204_3456_2592.csv\n",
      "=> cnt=248 result=0.7545, 0.9912\n",
      "250 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42219_1540022498_3072_2304.csv\n",
      "=> cnt=249 result=0.7807, 0.9763\n",
      "251 Kodak_M1063_0_9557_Nikon_D200_0_15046_1540018875_3872_2592.csv\n",
      "=> cnt=250 result=0.2314, 0.9233\n",
      "252 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42204_1540042188_3072_2304.csv\n",
      "=> cnt=251 result=0.8034, 0.9971\n",
      "253 Kodak_M1063_0_9583_Nikon_D200_0_14902_1540130293_3872_2592.csv\n",
      "=> cnt=252 result=0.1012, 0.9429\n",
      "254 Rollei_RCP-7325XS_0_42267_Sony_DSC-H50_0_47002_1540033845_3456_2592.csv\n",
      "=> cnt=253 result=0.8187, 0.9935\n",
      "255 Agfa_Sensor505-x_0_1627_Kodak_M1063_0_9367_1540013495_3664_2748.csv\n",
      "=> cnt=254 result=0.3571, 0.9975\n",
      "256 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42205_1540044773_3072_2304.csv\n",
      "=> cnt=255 result=0.9121, 0.9983\n",
      "257 Kodak_M1063_0_9564_Nikon_D200_0_15078_1540019372_3872_2592.csv\n",
      "=> cnt=256 result=0.5000, 0.9888\n",
      "258 Agfa_Sensor505-x_0_1859_Kodak_M1063_0_9583_1540017096_3664_2748.csv\n",
      "=> cnt=257 result=0.7917, 0.9950\n",
      "259 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42220_1540022506_3072_2304.csv\n",
      "=> cnt=258 result=0.0059, 0.9097\n",
      "260 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42222_1540045607_3072_2304.csv\n",
      "=> cnt=259 result=0.8121, 0.9902\n",
      "261 Rollei_RCP-7325XS_0_42262_Sony_DSC-H50_0_47002_1540034480_3456_2592.csv\n",
      "=> cnt=260 result=0.8506, 0.9838\n",
      "262 Rollei_RCP-7325XS_0_42359_Sony_DSC-H50_0_46927_1540028069_3456_2592.csv\n",
      "=> cnt=261 result=0.7685, 0.9944\n",
      "263 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1921_1540036400_2592_1944.csv\n",
      "=> cnt=262 result=0.7647, 0.9733\n",
      "264 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42306_1540045721_3072_2304.csv\n",
      "=> cnt=263 result=0.7987, 0.9902\n",
      "265 Rollei_RCP-7325XS_0_42262_Sony_DSC-H50_0_46972_1540034762_3456_2592.csv\n",
      "=> cnt=264 result=0.9403, 0.9833\n",
      "266 Agfa_Sensor505-x_0_1858_Kodak_M1063_0_9585_1540017113_3664_2748.csv\n",
      "=> cnt=265 result=0.7792, 0.9967\n",
      "267 Agfa_Sensor505-x_0_1857_Kodak_M1063_0_9470_1540017792_3664_2748.csv\n",
      "=> cnt=266 result=0.8681, 0.9958\n",
      "268 Sony_DSC-H50_0_47366_Agfa_Sensor505-x_0_1638_1540036204_2592_1944.csv\n",
      "=> cnt=267 result=0.5250, 0.9775\n",
      "269 Kodak_M1063_0_9473_Nikon_D200_0_14934_1540017981_3872_2592.csv\n",
      "=> cnt=268 result=0.5556, 0.9825\n",
      "270 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1783_1540036871_2592_1944.csv\n",
      "=> cnt=269 result=0.7054, 0.9842\n",
      "271 Rollei_RCP-7325XS_0_42364_Sony_DSC-H50_0_46946_1540028084_3456_2592.csv\n",
      "=> cnt=270 result=0.6545, 0.9866\n",
      "272 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42219_1540023093_3072_2304.csv\n",
      "=> cnt=271 result=0.4286, 0.9537\n",
      "273 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47002_1540023810_3456_2592.csv\n",
      "=> cnt=272 result=0.8500, 0.9907\n",
      "274 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1878_1540036373_2592_1944.csv\n",
      "=> cnt=273 result=0.7375, 0.9767\n",
      "275 Sony_DSC-H50_0_46968_Agfa_Sensor505-x_0_1683_1540037187_2592_1944.csv\n",
      "=> cnt=274 result=0.6375, 0.9883\n",
      "276 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42222_1540042508_3072_2304.csv\n",
      "=> cnt=275 result=0.7778, 1.0000\n",
      "277 Sony_DSC-H50_0_47447_Agfa_Sensor505-x_0_1708_1540036820_2592_1944.csv\n",
      "=> cnt=276 result=0.9111, 0.9942\n",
      "278 Agfa_Sensor505-x_0_1627_Kodak_M1063_0_9393_1540013514_3664_2748.csv\n",
      "=> cnt=277 result=0.9307, 0.9996\n",
      "279 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1675_1540035562_2592_1944.csv\n",
      "=> cnt=278 result=0.6806, 0.9733\n",
      "280 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42316_1540045751_3072_2304.csv\n",
      "=> cnt=279 result=0.8067, 0.9890\n",
      "281 Nikon_D200_0_14908_Rollei_RCP-7325XS_0_42194_1540022159_3072_2304.csv\n",
      "=> cnt=280 result=0.7708, 0.9832\n",
      "282 Rollei_RCP-7325XS_0_42375_Sony_DSC-H50_0_47009_1540034857_3456_2592.csv\n",
      "=> cnt=281 result=0.9510, 0.9958\n",
      "283 Kodak_M1063_0_9489_Nikon_D200_0_14908_1540128707_3872_2592.csv\n",
      "=> cnt=282 result=0.8720, 0.9150\n",
      "284 Kodak_M1063_0_9489_Nikon_D200_0_15012_1540018801_3872_2592.csv\n",
      "=> cnt=283 result=0.5467, 0.9921\n",
      "285 Agfa_Sensor505-x_0_1702_Kodak_M1063_0_9393_1540014113_3664_2748.csv\n",
      "=> cnt=284 result=0.9319, 1.0000\n",
      "286 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42204_1540042444_3072_2304.csv\n",
      "=> cnt=285 result=0.7232, 0.9902\n",
      "287 Kodak_M1063_0_9457_Nikon_D200_0_15008_1540106226_3872_2592.csv\n",
      "=> cnt=286 result=0.1333, 0.9321\n",
      "288 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42208_1540044803_3072_2304.csv\n",
      "=> cnt=287 result=0.7667, 0.9821\n",
      "289 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42273_1540045639_3072_2304.csv\n",
      "=> cnt=288 result=0.9244, 0.9902\n",
      "290 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42205_1540042595_3072_2304.csv\n",
      "=> cnt=289 result=0.9000, 0.9942\n",
      "291 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42204_1540022792_3072_2304.csv\n",
      "=> cnt=290 result=0.3010, 0.9311\n",
      "292 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42208_1540045861_3072_2304.csv\n",
      "=> cnt=291 result=0.8375, 0.9878\n",
      "293 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42316_1540023344_3072_2304.csv\n",
      "=> cnt=292 result=0.8137, 0.9913\n",
      "294 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42203_1540046309_3072_2304.csv\n",
      "=> cnt=293 result=0.8636, 0.9948\n",
      "295 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_46951_1540023593_3456_2592.csv\n",
      "=> cnt=294 result=0.8485, 0.9977\n",
      "296 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1629_1540036538_2592_1944.csv\n",
      "=> cnt=295 result=0.8737, 0.9683\n",
      "297 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42218_1540023080_3072_2304.csv\n",
      "=> cnt=296 result=0.8667, 0.9902\n",
      "298 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42219_1540042280_3072_2304.csv\n",
      "=> cnt=297 result=0.7562, 0.9902\n",
      "299 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42273_1540022907_3072_2304.csv\n",
      "=> cnt=298 result=0.8092, 0.9178\n",
      "300 Kodak_M1063_0_9559_Nikon_D200_0_15046_1540130260_3872_2592.csv\n",
      "=> cnt=299 result=0.1235, 0.9175\n",
      "301 Agfa_Sensor505-x_0_1695_Kodak_M1063_0_9474_1540013715_3664_2748.csv\n",
      "=> cnt=300 result=0.3750, 1.0000\n",
      "302 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46996_1540023728_3456_2592.csv\n",
      "=> cnt=301 result=0.8222, 0.9931\n",
      "303 Nikon_D200_0_15026_Kodak_M1063_0_9525_1540040848_3664_2748.csv\n",
      "=> cnt=302 result=0.8238, 0.9921\n",
      "304 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42205_1540023237_3072_2304.csv\n",
      "=> cnt=303 result=0.8891, 0.9792\n",
      "305 Sony_DSC-H50_0_47009_Agfa_Sensor505-x_0_1628_1540035138_2592_1944.csv\n",
      "=> cnt=304 result=0.8816, 0.9733\n",
      "306 Nikon_D200_0_14908_Kodak_M1063_0_9407_1540038210_3664_2748.csv\n",
      "=> cnt=305 result=0.8199, 0.9891\n",
      "307 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42219_1540046488_3072_2304.csv\n",
      "=> cnt=306 result=0.8000, 0.9890\n",
      "308 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42209_1540044314_3072_2304.csv\n",
      "=> cnt=307 result=0.8651, 0.9948\n",
      "309 Nikon_D200_0_14908_Rollei_RCP-7325XS_0_42194_1540022746_3072_2304.csv\n",
      "=> cnt=308 result=0.8075, 0.9832\n",
      "310 Nikon_D200_0_15026_Kodak_M1063_0_9410_1540040401_3664_2748.csv\n",
      "=> cnt=309 result=0.8000, 0.9916\n",
      "311 Rollei_RCP-7325XS_0_42262_Sony_DSC-H50_0_46919_1540034404_3456_2592.csv\n",
      "=> cnt=310 result=0.8333, 0.9806\n",
      "312 Kodak_M1063_0_9579_Rollei_RCP-7325XS_0_42203_1540046951_3072_2304.csv\n",
      "=> cnt=311 result=0.7984, 0.9803\n",
      "313 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42236_1540022293_3072_2304.csv\n",
      "=> cnt=312 result=0.3314, 0.9381\n",
      "314 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46904_1540027916_3456_2592.csv\n",
      "=> cnt=313 result=0.8865, 0.9954\n",
      "315 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_47024_1540034140_3456_2592.csv\n",
      "=> cnt=314 result=0.8250, 0.9921\n",
      "316 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42222_1540044893_3072_2304.csv\n",
      "=> cnt=315 result=0.7576, 0.9902\n",
      "317 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46910_1540023417_3456_2592.csv\n",
      "=> cnt=316 result=0.8990, 0.9912\n",
      "318 Nikon_D200_0_15026_Kodak_M1063_0_9516_1540040614_3664_2748.csv\n",
      "=> cnt=317 result=0.8286, 0.9908\n",
      "319 Sony_DSC-H50_0_47447_Agfa_Sensor505-x_0_1675_1540037111_2592_1944.csv\n",
      "=> cnt=318 result=0.7013, 0.9850\n",
      "320 Sony_DSC-H50_0_46908_Agfa_Sensor505-x_0_1681_1540037138_2592_1944.csv\n",
      "=> cnt=319 result=0.6615, 0.9925\n",
      "321 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_47012_1540028218_3456_2592.csv\n",
      "=> cnt=320 result=0.9417, 0.9907\n",
      "322 Nikon_D200_0_15137_Rollei_RCP-7325XS_0_42203_1540124910_3072_2304.csv\n",
      "=> cnt=321 result=0.8646, 0.9896\n",
      "323 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42314_1540045741_3072_2304.csv\n",
      "=> cnt=322 result=0.7933, 0.9878\n",
      "324 Kodak_M1063_0_9579_Nikon_D200_0_14908_1540124748_3872_2592.csv\n",
      "=> cnt=323 result=0.7568, 0.8717\n",
      "325 Rollei_RCP-7325XS_0_42208_Sony_DSC-H50_0_46903_1540023403_3456_2592.csv\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "=> cnt=324 result=0.8541, 0.9889\n",
      "326 Kodak_M1063_0_9557_Rollei_RCP-7325XS_0_42307_1540046132_3072_2304.csv\n",
      "=> cnt=325 result=0.8091, 0.9792\n",
      "327 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42207_1540044278_3072_2304.csv\n",
      "=> cnt=326 result=0.6875, 0.9884\n",
      "328 Kodak_M1063_0_9579_Nikon_D200_0_14902_1540107165_3872_2592.csv\n",
      "=> cnt=327 result=0.8262, 0.9867\n",
      "329 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42216_1540045419_3072_2304.csv\n",
      "=> cnt=328 result=0.8611, 0.9907\n",
      "330 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42236_1540022532_3072_2304.csv\n",
      "=> cnt=329 result=0.1648, 0.9184\n",
      "331 Nikon_D200_0_14908_Kodak_M1063_0_9457_1540040775_2748_3664.csv\n",
      "=> cnt=330 result=0.7888, 0.9829\n",
      "332 Kodak_M1063_0_9583_Rollei_RCP-7325XS_0_42322_1540046173_3072_2304.csv\n",
      "=> cnt=331 result=0.8182, 0.9907\n",
      "333 Sony_DSC-H50_0_47002_Agfa_Sensor505-x_0_1627_1540035024_2592_1944.csv\n",
      "=> cnt=332 result=0.7097, 0.9967\n",
      "334 Rollei_RCP-7325XS_0_42250_Sony_DSC-H50_0_46972_1540023710_3456_2592.csv\n",
      "=> cnt=333 result=0.9356, 0.9787\n",
      "335 Agfa_Sensor505-x_0_1788_Kodak_M1063_0_9406_1540014453_3664_2748.csv\n",
      "=> cnt=334 result=0.6061, 0.9954\n",
      "336 Nikon_D200_0_14908_Kodak_M1063_0_9395_1540038181_3664_2748.csv\n",
      "=> cnt=335 result=0.8714, 0.9871\n",
      "337 Sony_DSC-H50_0_47027_Rollei_RCP-7325XS_0_42269_1540042378_3072_2304.csv\n",
      "=> cnt=336 result=0.9145, 0.9838\n",
      "338 Sony_DSC-H50_0_47035_Rollei_RCP-7325XS_0_42203_1540044126_3072_2304.csv\n",
      "=> cnt=337 result=0.7564, 0.9971\n",
      "339 Rollei_RCP-7325XS_0_42364_Sony_DSC-H50_0_47021_1540034122_3456_2592.csv\n",
      "=> cnt=338 result=0.8091, 0.9954\n",
      "340 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42216_1540045915_3072_2304.csv\n",
      "=> cnt=339 result=0.7818, 0.9855\n",
      "341 Sony_DSC-H50_0_46954_Agfa_Sensor505-x_0_1632_1540037028_2592_1944.csv\n",
      "=> cnt=340 result=0.4200, 0.9425\n",
      "342 Sony_DSC-H50_0_47021_Agfa_Sensor505-x_0_1629_1540035230_2592_1944.csv\n",
      "=> cnt=341 result=0.8697, 0.9658\n",
      "343 Nikon_D200_0_15026_Kodak_M1063_0_9532_1540040877_3664_2748.csv\n",
      "=> cnt=342 result=0.8558, 0.9904\n",
      "344 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1627_1540124824_2592_1944.csv\n",
      "=> cnt=343 result=0.7946, 0.9942\n",
      "345 Agfa_Sensor505-x_0_1821_Kodak_M1063_0_9457_1540016940_2748_3664.csv\n",
      "=> cnt=344 result=0.7714, 0.9962\n",
      "346 Agfa_Sensor505-x_0_1857_Kodak_M1063_0_9407_1540130463_3664_2748.csv\n",
      "=> cnt=345 result=0.7604, 0.9958\n",
      "347 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42194_1540042432_3072_2304.csv\n",
      "=> cnt=346 result=0.7857, 0.9936\n",
      "348 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42216_1540042477_3072_2304.csv\n",
      "=> cnt=347 result=0.6875, 0.9878\n",
      "349 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42214_1540042461_3072_2304.csv\n",
      "=> cnt=348 result=0.7143, 0.9890\n",
      "350 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42214_1540042635_3072_2304.csv\n",
      "=> cnt=349 result=0.7292, 0.9942\n",
      "351 Nikon_D200_0_15022_Kodak_M1063_0_9542_1540040705_3664_2748.csv\n",
      "=> cnt=350 result=0.8667, 0.9825\n",
      "352 Sony_DSC-H50_0_47447_Rollei_RCP-7325XS_0_42205_1540044237_3072_2304.csv\n",
      "=> cnt=351 result=0.9172, 1.0000\n",
      "353 Sony_DSC-H50_0_46951_Agfa_Sensor505-x_0_1627_1540130356_2592_1944.csv\n",
      "=> cnt=352 result=0.8067, 0.9925\n",
      "354 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47018_1540034061_3456_2592.csv\n",
      "=> cnt=353 result=0.8458, 0.9940\n",
      "355 Kodak_M1063_0_9490_Nikon_D200_0_14984_1540018088_3872_2592.csv\n",
      "=> cnt=354 result=0.7200, 1.0000\n",
      "356 Kodak_M1063_0_9565_Nikon_D200_0_15080_1540019393_3872_2592.csv\n",
      "=> cnt=355 result=0.7143, 0.9971\n",
      "357 Agfa_Sensor505-x_0_1783_Kodak_M1063_0_9406_1540014137_3664_2748.csv\n",
      "=> cnt=356 result=0.6250, 0.9996\n",
      "358 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_46946_1540023575_3456_2592.csv\n",
      "=> cnt=357 result=0.8278, 0.9977\n",
      "359 Nikon_D200_0_15026_Kodak_M1063_0_9407_1540040187_3664_2748.csv\n",
      "=> cnt=358 result=0.8410, 0.9916\n",
      "360 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42240_1540042533_3072_2304.csv\n",
      "=> cnt=359 result=0.8224, 0.9861\n",
      "361 Rollei_RCP-7325XS_0_42337_Sony_DSC-H50_0_47015_1540034038_3456_2592.csv\n",
      "=> cnt=360 result=0.8429, 0.9944\n",
      "362 Kodak_M1063_0_9559_Nikon_D200_0_15056_1540018897_3872_2592.csv\n",
      "=> cnt=361 result=0.0357, 0.9896\n",
      "363 Nikon_D200_0_15026_Kodak_M1063_0_9534_1540040882_3664_2748.csv\n",
      "=> cnt=362 result=0.8462, 0.9937\n",
      "364 Nikon_D200_0_15026_Kodak_M1063_0_9543_1540040899_3664_2748.csv\n",
      "=> cnt=363 result=0.8857, 0.9921\n",
      "365 Sony_DSC-H50_0_47413_Rollei_RCP-7325XS_0_42218_1540044497_3072_2304.csv\n",
      "=> cnt=364 result=0.7333, 0.9809\n",
      "366 Nikon_D200_0_15022_Rollei_RCP-7325XS_0_42205_1540022231_3072_2304.csv\n",
      "=> cnt=365 result=0.8138, 0.9653\n",
      "367 Nikon_D200_0_15026_Kodak_M1063_0_9489_1540040445_3664_2748.csv\n",
      "=> cnt=366 result=0.8524, 0.9937\n",
      "368 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42219_1540045947_3072_2304.csv\n",
      "=> cnt=367 result=0.7879, 0.9861\n",
      "369 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42273_1540022561_3072_2304.csv\n",
      "=> cnt=368 result=0.8304, 0.9311\n",
      "370 Sony_DSC-H50_0_46962_Agfa_Sensor505-x_0_1628_1540035423_2592_1944.csv\n",
      "=> cnt=369 result=0.8303, 0.9408\n",
      "371 Nikon_D200_0_14908_Kodak_M1063_0_9493_1540040806_3664_2748.csv\n",
      "=> cnt=370 result=0.8199, 0.9896\n",
      "372 Nikon_D200_0_15026_Kodak_M1063_0_9493_1540040464_3664_2748.csv\n",
      "=> cnt=371 result=0.8429, 0.9921\n",
      "373 Agfa_Sensor505-x_0_1620_Kodak_M1063_0_9531_1540013851_3664_2748.csv\n",
      "=> cnt=372 result=0.4000, 0.9979\n",
      "374 Agfa_Sensor505-x_0_1858_Kodak_M1063_0_9409_1540130471_3664_2748.csv\n",
      "=> cnt=373 result=0.8021, 0.9954\n",
      "375 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_47002_1540028195_3456_2592.csv\n",
      "=> cnt=374 result=0.5062, 0.9699\n",
      "376 Sony_DSC-H50_0_47027_Agfa_Sensor505-x_0_1628_1540036420_2592_1944.csv\n",
      "=> cnt=375 result=0.8895, 0.9783\n",
      "377 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42316_1540043961_3072_2304.csv\n",
      "=> cnt=376 result=0.8077, 0.9942\n",
      "378 Kodak_M1063_0_9555_Rollei_RCP-7325XS_0_42220_1540045515_3072_2304.csv\n",
      "=> cnt=377 result=0.7923, 0.9867\n",
      "379 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42208_1540044299_3072_2304.csv\n",
      "=> cnt=378 result=0.6875, 0.9873\n",
      "380 Rollei_RCP-7325XS_0_42376_Sony_DSC-H50_0_46962_1540023607_3456_2592.csv\n",
      "=> cnt=379 result=0.9473, 0.9991\n",
      "381 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42205_1540042451_3072_2304.csv\n",
      "=> cnt=380 result=0.8931, 0.9919\n",
      "382 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46996_1540028177_3456_2592.csv\n",
      "=> cnt=381 result=0.8523, 0.9935\n",
      "383 Agfa_Sensor505-x_0_1859_Kodak_M1063_0_9555_1540017061_3664_2748.csv\n",
      "=> cnt=382 result=0.7614, 0.9967\n",
      "384 Sony_DSC-H50_0_47035_Rollei_RCP-7325XS_0_42276_1540042395_3072_2304.csv\n",
      "=> cnt=383 result=0.9052, 0.9948\n",
      "385 Agfa_Sensor505-x_0_1633_Kodak_M1063_0_9407_1540013637_3664_2748.csv\n",
      "=> cnt=384 result=0.6571, 0.9967\n",
      "386 Kodak_M1063_0_9557_Rollei_RCP-7325XS_0_42207_1540046408_3072_2304.csv\n",
      "=> cnt=385 result=0.7773, 0.9861\n",
      "387 Kodak_M1063_0_9559_Rollei_RCP-7325XS_0_42216_1540046441_3072_2304.csv\n",
      "=> cnt=386 result=0.7273, 0.9890\n",
      "388 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46910_1540027974_3456_2592.csv\n",
      "=> cnt=387 result=0.7811, 0.9773\n",
      "389 Agfa_Sensor505-x_0_1811_Kodak_M1063_0_9471_1540014512_3664_2748.csv\n",
      "=> cnt=388 result=0.9084, 0.9992\n",
      "390 Nikon_D200_0_15026_Rollei_RCP-7325XS_0_42273_1540022323_3072_2304.csv\n",
      "=> cnt=389 result=0.8931, 0.9705\n",
      "391 Rollei_RCP-7325XS_0_42252_Sony_DSC-H50_0_46912_1540034388_3456_2592.csv\n",
      "=> cnt=390 result=0.8067, 0.9898\n",
      "392 Kodak_M1063_0_9457_Rollei_RCP-7325XS_0_42215_1540044821_3072_2304.csv\n",
      "=> cnt=391 result=0.7955, 0.9815\n",
      "393 Kodak_M1063_0_9523_Nikon_D200_0_15012_1540128751_3872_2592.csv\n",
      "=> cnt=392 result=0.2893, 0.9242\n",
      "394 Kodak_M1063_0_9584_Rollei_RCP-7325XS_0_42306_1540046593_3072_2304.csv\n",
      "=> cnt=393 result=0.8166, 0.9907\n",
      "395 Agfa_Sensor505-x_0_1811_Kodak_M1063_0_9529_1540014253_3664_2748.csv\n",
      "=> cnt=394 result=0.6667, 0.9975\n",
      "396 Nikon_D200_0_14902_Kodak_M1063_0_9393_1540038166_3664_2748.csv\n",
      "=> cnt=395 result=0.9271, 0.9983\n",
      "397 Sony_DSC-H50_0_46951_Rollei_RCP-7325XS_0_42236_1540042526_3072_2304.csv\n",
      "=> cnt=396 result=0.6786, 0.9861\n",
      "398 Sony_DSC-H50_0_46953_Rollei_RCP-7325XS_0_42320_1540043976_3072_2304.csv\n",
      "=> cnt=397 result=0.8482, 0.9936\n",
      "399 Kodak_M1063_0_9579_Rollei_RCP-7325XS_0_42204_1540046936_3072_2304.csv\n",
      "=> cnt=398 result=0.7849, 0.9757\n",
      "400 Kodak_M1063_0_9579_Nikon_D200_0_14934_1540124764_3872_2592.csv\n",
      "=> cnt=399 result=0.0658, 0.8829\n"
     ]
    }
   ],
   "source": [
    "# Local & global accuracy of localization\n",
    "\n",
    "def get_label(name):\n",
    "    name_label = {\n",
    "        \"Agfa\": 0,\n",
    "        \"Kodak\": 1,\n",
    "        \"Nikon\": 2,\n",
    "        \"Rollei\": 3,\n",
    "        \"Sony\": 4\n",
    "    }\n",
    "    name_list = name.split(\"_\")\n",
    "    return (name_label[name_list[0]], name_label[name_list[4]])    \n",
    "\n",
    "cnt, score, threshold_1, threshold_2 = 0, 0, 0.7, 0.0\n",
    "result = np.zeros([len(os.listdir(csv_root)), 4])\n",
    "\n",
    "for name in os.listdir(csv_root):\n",
    "    print(cnt + 1, name)\n",
    "    \n",
    "    (_w, _h) = (int(int(name.split(\"_\")[-2])), int(int(name.split(\"_\")[-1].split(\".\")[-2])))\n",
    "    (w, h) = int(_w / 64), int(_h / 64)\n",
    "    \n",
    "    # @raw_data=[f1, f2, f3, f4, f5, p, y, texture]\n",
    "    raw_data = pd.read_csv(csv_root + \"/\" + name).values[:w*h, 1:9]\n",
    "    \n",
    "    # get label\n",
    "    label1, label2 = get_label(name)\n",
    "    \n",
    "    # f-L1 clustering1\n",
    "    f_data = kmeans(raw_data, threshold_1, label2, w, h)\n",
    "    # texture clustering2\n",
    "    t_data = filter_texture(f_data, label2, threshold_2)\n",
    "    # denisty clustering3\n",
    "    d_data = filter_denisty(t_data, label2, w, h)\n",
    "    \n",
    "    d_data[d_data[:, 5] != label2] = label1\n",
    "    \n",
    "    # final map\n",
    "    show_binary(raw_data, w, h)\n",
    "    \n",
    "    full_count = np.sum(np.equal(d_data[:, 5], t_data[:, 6]))\n",
    "    full_area = w*h\n",
    "    \n",
    "    mark_x, mark_y = local_detect_region(d_data, label2, w, h)\n",
    "    (local_count, local_area) = local_accuracy(d_data, label2, mark_x, mark_y, w, h)\n",
    "    \n",
    "    result[cnt, :] = np.array(list([local_count, float(local_count/local_area), full_count, float(full_count/full_area)]))\n",
    "    print(\"=> cnt={:d} result={:.4f}, {:.4f}\".format(cnt, result[cnt, 1], result[cnt, 3]))\n",
    "    \n",
    "    cnt += 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 347,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.733743428382813"
      ]
     },
     "execution_count": 347,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.sum(result[:, 1]) / 400"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 348,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9829811912593985"
      ]
     },
     "execution_count": 348,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.sum(result[:, 3]) / 400"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
